'use strict';

function median_to_letter(collection) {
  let i;
  if(collection.length%2===0){
    i=Math.ceil((collection[collection.length/2]+collection[collection.length/2-1])/2);
  }
  else {
    i=Math.ceil(collection[(collection.length-1)/2]);
  }
  if(i<=26){
    return String.fromCharCode(i+96);
  }
  else {
    if(i%26===0){
      return String.fromCharCode(i/26-1+96)+String.fromCharCode(26+96);
    }
    else {
      return String.fromCharCode(parseInt(i/26)+96)+String.fromCharCode(i%26+96);
    }
  }
}

module.exports = median_to_letter;
